
function getbody()
{
		var current = "master";
		document.getElementsByTagName('body')[0].id = current;
		document.getElementById('content').innerHTML = current;
		new Ajax.Updater('content', 'master.php', { method: 'get' });
}

function cp(page_name)
{
	if (page_name != "slave") page_name = "master";

	document.getElementsByTagName('body')[0].id = page_name;
//	document.getElementById('content').innerHTML = current;
	new Ajax.Updater('content', page_name+'.php', { method: 'get' });

}

function gp(btn, req_type)
{
	if (req_type == 'master') {
		new Ajax.Request('api.php', {
			method: 'get',
			parameters: {
				t: 'master' ,
				lc: $('lowercase').checked,
				uc: $('uppercase').checked,
				s: (($('chk_symbol').checked) ? $('symbols').value : ''),
				n: $('numbers').checked,
				l: $('length').options[$('length').selectedIndex].value,
				o: 'html',
				nocache: new Date().getTime()
			},
			onSuccess: function(transport) {
				$("password").innerHTML = transport.responseText;
			},
			onFailure: function() {
				alert("Error: Please check parameters...");
			}
		});
	}
	else if (req_type == 'slave') {
		if ($('masterpassword').value.length == 0)
		{
			alert("Please check master password!");
			$('masterpassword').focus();
			return false;
		}

		if ($('domain').value.search(/\./) == -1)
		{
			alert("Please check website address (domain)");
			$('domain').focus();
			return false;
		}

		new Ajax.Request('api.php', {
			method: 'get',
			parameters: {
				t: 'slave',
				mp: $('masterpassword').value,
				d: $('domain').value,
				lc: $('lowercase').checked,
				uc: $('uppercase').checked,
				s: (($('chk_symbol').checked) ? $('symbols').value : ''),
				n: $('numbers').checked,
				l: $('length').options[$('length').selectedIndex].value,
				o: 'html',
				nocache: new Date().getTime()
			},
			onSuccess: function(transport) {
				$("password").innerHTML = transport.responseText;
			},
			onFailure: function() {
				alert("Error: Please check parameters...");
			}
		});

	}

	if (Prototype.Browser.IE)
		$('result').style.display ='block';
	else
		$('result').style.display ='table-row';

	btn.value = "Re Generate";

//	$('result').style.display ='none';

}


